/**
 * Created by dukes on 2015/12/10.
 */
class RedPointMgr{
    public static TRAVE_ICON = 0;
    public static DEC_ICON = 1;
    public static GETOU_ICON = 2;
    public static MAIL_ICON = 3;
    public static CHAT_ICON = 4;
    public static MONEY_CAT_ICON = 5;
    public static ACTIVITY_ICON = 6;
    public static ACHIEVE = 7;
    public static CHAT_TAB = 8;
    public static RECHARGE_ICON = 9;
    public static MOOD_BUFF = 10;
    public static VIP_MISSION = 11;
    public static GUILD_ICON = 12;
    public static GUILD_APPLY = 13;
    public static GUILD_LOBBY_ICON = 14;
    private pointMap;
    private valueMap;
    public constructor(){
        this.pointMap = {};
        this.valueMap = {};
    }

    public registerPoint(index:number, point:eui.Image){
        this.pointMap[index] = point;
        if( this.valueMap[index])
            point.visible = this.valueMap[index];
    }

    public getState(index:number):boolean{
        return this.valueMap[index];
    }

    public update(index:number,value:boolean){
        this.valueMap[index] = value;
        var point:eui.Image = this.pointMap[index];
        if( !point){
            return;
        }
        if( point.visible == value) return;
        point.visible = value;
    }

    private static _instance:RedPointMgr;
    public static getInstance():RedPointMgr{
        if( RedPointMgr._instance == null)
            RedPointMgr._instance = new RedPointMgr();
        return RedPointMgr._instance;
    }
}